import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/closure/access_record_entity.dart';

AccessRecordEntity $AccessRecordEntityFromJson(Map<String, dynamic> json) {
  final AccessRecordEntity accessRecordEntity = AccessRecordEntity();
  final String? carType = jsonConvert.convert<String>(json['carType']);
  if (carType != null) {
    accessRecordEntity.carType = carType;
  }
  final String? affiliatedUnit = jsonConvert.convert<String>(json['affiliatedUnit']);
  if (affiliatedUnit != null) {
    accessRecordEntity.affiliatedUnit = affiliatedUnit;
  }
  final String? carTypeName = jsonConvert.convert<String>(json['carTypeName']);
  if (carTypeName != null) {
    accessRecordEntity.carTypeName = carTypeName;
  }
  final String? companyCodeName = jsonConvert.convert<String>(json['companyCodeName']);
  if (companyCodeName != null) {
    accessRecordEntity.companyCodeName = companyCodeName;
  }
  final String? contactPerson = jsonConvert.convert<String>(json['contactPerson']);
  if (contactPerson != null) {
    accessRecordEntity.contactPerson = contactPerson;
  }
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    accessRecordEntity.createDate = createDate;
  }
  final String? destination = jsonConvert.convert<String>(json['destination']);
  if (destination != null) {
    accessRecordEntity.destination = destination;
  }
  final String? endDate = jsonConvert.convert<String>(json['endDate']);
  if (endDate != null) {
    accessRecordEntity.endDate = endDate;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    accessRecordEntity.id = id;
  }
  final String? inDate = jsonConvert.convert<String>(json['inDate']);
  if (inDate != null) {
    accessRecordEntity.inDate = inDate;
  }
  final String? inGateId = jsonConvert.convert<String>(json['inGateId']);
  if (inGateId != null) {
    accessRecordEntity.inGateId = inGateId;
  }
  final String? inGateName = jsonConvert.convert<String>(json['inGateName']);
  if (inGateName != null) {
    accessRecordEntity.inGateName = inGateName;
  }
  final String? licensePlate = jsonConvert.convert<String>(json['licensePlate']);
  if (licensePlate != null) {
    accessRecordEntity.licensePlate = licensePlate;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    accessRecordEntity.name = name;
  }
  final int? numberOfViolations = jsonConvert.convert<int>(json['numberOfViolations']);
  if (numberOfViolations != null) {
    accessRecordEntity.numberOfViolations = numberOfViolations;
  }
  final String? outDate = jsonConvert.convert<String>(json['outDate']);
  if (outDate != null) {
    accessRecordEntity.outDate = outDate;
  }
  final String? outGateName = jsonConvert.convert<String>(json['outGateName']);
  if (outGateName != null) {
    accessRecordEntity.outGateName = outGateName;
  }
  final String? outId = jsonConvert.convert<String>(json['outId']);
  if (outId != null) {
    accessRecordEntity.outId = outId;
  }
  final String? parkId = jsonConvert.convert<String>(json['parkId']);
  if (parkId != null) {
    accessRecordEntity.parkId = parkId;
  }
  final int? permissionType = jsonConvert.convert<int>(json['permissionType']);
  if (permissionType != null) {
    accessRecordEntity.permissionType = permissionType;
  }
  final String? personToPersonPhoneNumber = jsonConvert.convert<String>(json['personToPersonPhoneNumber']);
  if (personToPersonPhoneNumber != null) {
    accessRecordEntity.personToPersonPhoneNumber = personToPersonPhoneNumber;
  }
  final String? personnelCategory = jsonConvert.convert<String>(json['personnelCategory']);
  if (personnelCategory != null) {
    accessRecordEntity.personnelCategory = personnelCategory;
  }
  final String? transportMedium = jsonConvert.convert<String>(json['transportMedium']);
  if (transportMedium != null) {
    accessRecordEntity.transportMedium = transportMedium;
  }
  final String? reasonForVisit = jsonConvert.convert<String>(json['reasonForVisit']);
  if (reasonForVisit != null) {
    accessRecordEntity.reasonForVisit = reasonForVisit;
  }
  final int? recordType = jsonConvert.convert<int>(json['recordType']);
  if (recordType != null) {
    accessRecordEntity.recordType = recordType;
  }
  final String? startDate = jsonConvert.convert<String>(json['startDate']);
  if (startDate != null) {
    accessRecordEntity.startDate = startDate;
  }
  final String? updateDate = jsonConvert.convert<String>(json['updateDate']);
  if (updateDate != null) {
    accessRecordEntity.updateDate = updateDate;
  }
  final String? visitorTelephone = jsonConvert.convert<String>(json['visitorTelephone']);
  if (visitorTelephone != null) {
    accessRecordEntity.visitorTelephone = visitorTelephone;
  }
  final String? companyCode = jsonConvert.convert<String>(json['companyCode']);
  if (companyCode != null) {
    accessRecordEntity.companyCode = companyCode;
  }
  return accessRecordEntity;
}

Map<String, dynamic> $AccessRecordEntityToJson(AccessRecordEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['carType'] = entity.carType;
  data['affiliatedUnit'] = entity.affiliatedUnit;
  data['carTypeName'] = entity.carTypeName;
  data['companyCodeName'] = entity.companyCodeName;
  data['contactPerson'] = entity.contactPerson;
  data['createDate'] = entity.createDate;
  data['destination'] = entity.destination;
  data['endDate'] = entity.endDate;
  data['id'] = entity.id;
  data['inDate'] = entity.inDate;
  data['inGateId'] = entity.inGateId;
  data['inGateName'] = entity.inGateName;
  data['licensePlate'] = entity.licensePlate;
  data['name'] = entity.name;
  data['numberOfViolations'] = entity.numberOfViolations;
  data['outDate'] = entity.outDate;
  data['outGateName'] = entity.outGateName;
  data['outId'] = entity.outId;
  data['parkId'] = entity.parkId;
  data['permissionType'] = entity.permissionType;
  data['personToPersonPhoneNumber'] = entity.personToPersonPhoneNumber;
  data['personnelCategory'] = entity.personnelCategory;
  data['transportMedium'] = entity.transportMedium;
  data['reasonForVisit'] = entity.reasonForVisit;
  data['recordType'] = entity.recordType;
  data['startDate'] = entity.startDate;
  data['updateDate'] = entity.updateDate;
  data['visitorTelephone'] = entity.visitorTelephone;
  data['companyCode'] = entity.companyCode;
  return data;
}

extension AccessRecordEntityExtension on AccessRecordEntity {
  AccessRecordEntity copyWith({
    String? carType,
    String? affiliatedUnit,
    String? carTypeName,
    String? companyCodeName,
    String? contactPerson,
    String? createDate,
    String? destination,
    String? endDate,
    String? id,
    String? inDate,
    String? inGateId,
    String? inGateName,
    String? licensePlate,
    String? name,
    int? numberOfViolations,
    String? outDate,
    String? outGateName,
    String? outId,
    String? parkId,
    int? permissionType,
    String? personToPersonPhoneNumber,
    String? personnelCategory,
    String? transportMedium,
    String? reasonForVisit,
    int? recordType,
    String? startDate,
    String? updateDate,
    String? visitorTelephone,
    String? companyCode,
  }) {
    return AccessRecordEntity()
      ..carType = carType ?? this.carType
      ..affiliatedUnit = affiliatedUnit ?? this.affiliatedUnit
      ..carTypeName = carTypeName ?? this.carTypeName
      ..companyCodeName = companyCodeName ?? this.companyCodeName
      ..contactPerson = contactPerson ?? this.contactPerson
      ..createDate = createDate ?? this.createDate
      ..destination = destination ?? this.destination
      ..endDate = endDate ?? this.endDate
      ..id = id ?? this.id
      ..inDate = inDate ?? this.inDate
      ..inGateId = inGateId ?? this.inGateId
      ..inGateName = inGateName ?? this.inGateName
      ..licensePlate = licensePlate ?? this.licensePlate
      ..name = name ?? this.name
      ..numberOfViolations = numberOfViolations ?? this.numberOfViolations
      ..outDate = outDate ?? this.outDate
      ..outGateName = outGateName ?? this.outGateName
      ..outId = outId ?? this.outId
      ..parkId = parkId ?? this.parkId
      ..permissionType = permissionType ?? this.permissionType
      ..personToPersonPhoneNumber = personToPersonPhoneNumber ?? this.personToPersonPhoneNumber
      ..personnelCategory = personnelCategory ?? this.personnelCategory
      ..transportMedium = transportMedium ?? this.transportMedium
      ..reasonForVisit = reasonForVisit ?? this.reasonForVisit
      ..recordType = recordType ?? this.recordType
      ..startDate = startDate ?? this.startDate
      ..updateDate = updateDate ?? this.updateDate
      ..visitorTelephone = visitorTelephone ?? this.visitorTelephone
      ..companyCode = companyCode ?? this.companyCode;
  }
}
